package com.itheima.Demo2;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Test {
    public static void main(String[] args) {
            List<String> objects = new ArrayList<>();
            objects.add("def");
            objects.add("xc");
            objects.add("sdsd");
            objects.add("def");
            objects.removeIf((String s)-> "def".equals(s));
        Iterator<String> objectIterator =objects.iterator();
        while (objectIterator.hasNext()){
            String s=objectIterator.next();
            System.out.print(s+" ");
        }
    }
}
